﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BookShelf.Model
{
    public class Author
    {

        public int ID { get; protected set; }
        public string FirstName { get; protected set; }
        public string MiddleName { get; protected set; }
        public string LastName { get; protected set; }
        public string Url { get; protected set; }
		public IList<Book> Books { get; protected set; }
        
        public Author(int id, string firstName, string middleName, string lastName)
        {

            if (id < 0)
                throw new ArgumentOutOfRangeException("id must be greater then or equal to zero");

            if (string.IsNullOrEmpty(firstName))
                throw new ArgumentNullException("firstName must not be null or empty.");

            if (string.IsNullOrEmpty(lastName))
                throw new ArgumentNullException("lastName must not be null or empty.");

            this.ID = id;
            this.FirstName = firstName;
            this.MiddleName = middleName;
            this.LastName = lastName;

        }

        public void SetUrl(string url)
        {
            this.Url = url;
        }

		public void SetBooks(IList<Book> books)
		{
			this.Books = books;
		}

    }
}
